<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<!-- https://blog.csdn.net/weixin_34179762/article/details/93781847 -->

<body>

</body>
<script>
  "use strict"; {
    let arr = [
      [0],
      [1, 2]
    ];
    const calc = (list) => {
      return list.reduce((pre, value, index, list_arr) => {
        let res = [];
        pre.forEach((pre_value, per_index, per_arr) => {
          value.forEach((item, key, value_arr) => {
            res.push(pre_value.concat([item]));
          });
        });
        return res;
      }, [[]]);
    };
    let res = calc(arr);
    console.log(res);
  };
</script>

</html>